<%@page import="java.util.List"%>
<%@page import="player.*"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@page errorPage="error.jsp" %>
<%@ include file="header.jspf" %>

<% 
Player player =  PlayerFabric.getInstance(((Integer)session.getAttribute("sport")).intValue());
String sport= null;
Integer sportId = (Integer)session.getAttribute("sport");
switch(sportId.intValue()) {
       case 1:
            sport = "football";
            break;
       case 2:;
            sport = "basketball";
            break;
       case 3:
            sport = "hockey";
            break;
}
%>

			<br class=clear>

			<div class="sportname">
				<h1><%= sport %> -> teams -> <jsp:include page="sport?page=team&mode=name" /> -> roster</h1>
			</div>

<nav class="submenu">
    <ul>
        <li class="item">
            <a href="teams.jsp">teams</a>
        </li>

        <li class="item">
            <a href="players.jsp">players</a>
        </li>
    </ul>
</nav>

			<br class=clear>

<%@ include file="team_submenu.jspf" %>

			<section class="middle">
				<div class="teaser">
					<div class="gray_teaser star_teaser">

						<p>Stats</p>

						<br class="clear">

						<div class="teaser-block-left f-left star_teaser">

							<table class="teaser-table" cellspacing="0" cellpadding="0" id="table">
								
							<thead>
                                                                       <th class="nosort"></th>
                                                                       <th>#</th>
                                                                       <th>name</th>
<%
if (player != null) {
    List attrs = player.getAttrsNames();
    for(int i=0; i < attrs.size(); i++) {
        if (!(attrs.get(i).equals("id") ||attrs.get(i).equals("teamId") ||attrs.get(i).equals("firstName") ||attrs.get(i).equals("lastName") ||attrs.get(i).equals("position") ||attrs.get(i).equals("name") || attrs.get(i).equals("country") || attrs.get(i).equals("height") || attrs.get(i).equals("weight") || attrs.get(i).equals("dateOfBirth"))) {
  
%>
                                                                        <th><%= attrs.get(i) %> </th>
<%
        }
   }
}
%> 
							</thead>
							<tbody>
                                                            <jsp:include page="sport?page=players&mode=stats" />								
							</tbody>
						</table>
						<script type="text/javascript">
var sorter = new TINY.table.sorter("sorter");
sorter.head = "head";
sorter.asc = "asc";
sorter.desc = "desc";
sorter.even = "evenrow";
sorter.odd = "oddrow";
sorter.evensel = "evenselected";
sorter.oddsel = "oddselected";
sorter.paginate = true;
sorter.currentid = "currentpage";
sorter.limitid = "pagelimit";
sorter.init("table",1);
</script>
					</div>

					<div class="border_teaser"></div>

				</div>
                                                        <br class="clear">
				<button class=sportbutton onclick="window.location = 'add_player.jsp';">add</button>
				&nbsp;&nbsp;
				<button class=sportbutton onclick="remove('players')">remove</button>
			</div>

			<br class="clear">
                   </section>
                        
<%@ include file="footer.jspf" %>